package com.ellecity06.cwhiskymall.ui.webview

import android.app.Activity
import com.ellecity06.cwhiskymall.constant.WebUrl
import com.ellecity06.cwhiskymall.storage.UserStorage

/**
 * @author ellecity06
 * @time 2024/11/4 10:46
 * @des
 */
class WebHelper {
    companion object {
        /**
         * 去商品详情
         * @param orderSource 0-商城订单；1-直播订单；
         */
        fun goodDetails(activity: Activity, id: Int?,orderSource:Int=0) {
            WebActivity.launch(activity, "${WebUrl.GoodDetail}${id}&orderSource=$orderSource")
        }

        /**
         * 去聚划算页面
         */
        fun superCostEffective(activity: Activity, id: Int?) {
            WebActivity.launch(activity, "${WebUrl.superCostEffective}$id")
        }

        /**
         * 专题页
         */
        fun subjectGoods(activity: Activity, id: Int?) {
            WebActivity.launch(activity, "${WebUrl.subjectGoods}$id")
        }

        /**
         * 订单列表 0 -全部，1-待付款，2 待发货，3待收货，4.售后
         */
        fun toOrderList(activity: Activity, state: Int?) {
            WebActivity.launch(activity, "${WebUrl.order}${state}")
        }

        /**
         * 收货地址
         */
        fun toAddressList(activity: Activity) {
            WebActivity.launch(activity, "${WebUrl.addressList}")
        }

        /**
         * 去购物车
         */
        fun toShopCart(activity: Activity) {
            WebActivity.launch(activity, "${WebUrl.shopCart}")
        }
        /**
         * 新人首单列表
         */
        fun toNewerGoosList(activity: Activity, id: Int,unlockStatus:Int?=null) {

            WebActivity.launch(
                activity,
                "${WebUrl.newerGoodList}?id=${id}&unlockStatus=${unlockStatus?: UserStorage.user?.unlockStatus}"
//                title = if (UserStorage.isVip()) "消费补贴" else "新人首单"
            )
        }
        /**
         * 去购物车
         */
        fun toKefu(activity: Activity) {
            WebActivity.launch(activity, "${WebUrl.kefu}")
        }

        /**
         * 用户协议
         */
        fun toUserAgreement(activity: Activity) {
            WebActivity.launch(activity, "${WebUrl.userAgreement}","用户协议")
        }

        /**
         * 隐私协议
         */
        fun toPrivateAgreement(activity: Activity) {
            WebActivity.launch(activity, "${WebUrl.privacyAgreement}","隐私政策")
        }
        /**
         * 弹窗活动页
         */
        fun toActivityPage(activity: Activity) {
            WebActivity.launch(activity, "${WebUrl.activtyPage}")
        }
        /**
         * 去文创活动页
         */
        fun toDionysusPage(activity: Activity,id:Int) {
            WebActivity.launch(activity, "${WebUrl.dionysusPage}${id}")
        }
        /**
         * 兑换应用
         */
        fun toRedeem(activity: Activity) {
            WebActivity.launch(activity, "${WebUrl.redeem}", "兑换应用")
        }

        /**
         * 兑换应记录
         */
        fun toRedeemRecord(activity: Activity) {
            WebActivity.launch(activity, "${WebUrl.redeemRecord}", "兑换记录")
        }

        /**
         * 贡献金
         */
        fun toAssetsRecord(activity: Activity) {
            WebActivity.launch(activity, "${WebUrl.assetsRecord}", "贡献金")
        }

        /**
         * 贡献金
         */
        fun toAssetsRecord2(activity: Activity) {
            WebActivity.launch(activity, "${WebUrl.assetsRecord2}", "待解锁")
        }

        /**
         * 流转平台-数据排名
         */
        fun toAssetsSort(activity: Activity) {
            WebActivity.launch(activity, "${WebUrl.assetsSort}", "数据排名", tokenType = 1)
        }

        /**
         * 流转平台-数据应用
         */
        fun toAssetsMarket(activity: Activity) {
            WebActivity.launch(activity, "${WebUrl.assetsMarket}", "数据应用", tokenType = 1)
        }
        /**
         * 流转平台-数据应用
         */
        fun toAssetsMine(activity: Activity) {
            WebActivity.launch(activity, "${WebUrl.assetsMine}", "我的应用", tokenType = 1)
        }

    }
}